/*
*  Copyright (C) 2009  Peter Kist & Jan Ripke
*
*  This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __mediator_intermediator_h
#define __mediator_intermediator_h 1

#include <string>

#include <Core/Mediator/Interface.h>
#include <Core/Mediator/Event.h>

namespace galaxy {
    namespace mediator {

        class Consumer;
        class Producer;

        namespace detail {            
            class MediatorImpl;
        }

        // Intermediator interface
        class InterMediator
        {
            static detail::MediatorImpl * m_Mediator;

        public:
            InterMediator ();
            ~InterMediator ();

            static void initialize ();
            static void terminate ();

            static bool registerProducer(Producer& producer);
            static bool unregisterProducer (int category);

            static bool registerConsumer(Consumer& consumer);
            static bool unregisterConsumer(std::string consumerType);

            static bool registerInterest(std::string consumerType, Identifier& interest);
            static bool unregisterInterest(std::string consumerType, Identifier& interest);

            static bool postEvent(Event& event, PostMethod postMethod);
            static bool RequestProducer(const Request &Request, RequestResultPtr& result);

            static detail::MediatorImpl& instance () { return *m_Mediator; };
        };

    } // mediator
} // galaxy 

#endif // __mediator_intermediator
